home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Unix / xgopher.1.3 / Documents / UFL-image / text0000.txt < prev   
Encoding:
Text File  |  1993-03-11  |  1.7 KB  |  62 lines

  1. Of course, the references to the image command must be changed.
  2.  
  3. In the X resources:
  4.  
  5. Xgopher.imageCommand:   /local/bin/gopher-display-image
  6.  
  7. If you administer the gopher server, you can teach it to recognize
  8. different image file formats automatically, or use .cap files to
  9. describe each file as a type 'I'.
  10. To teach the server you must also change the "gopherd.conf" to indicate
  11. the additional image file formats gopher-display-image supports.  In our case:
  12.  
  13. ext: .ps I 9 Postscript
  14. ext: .dvi I 9 DVI
  15.  
  16. This is necessary so that DVI and PostScript files will be recognized as
  17. images and thus passed to gopher-display-image, not the standard pager
  18. or text window.
  19.  
  20. ===========================================================================
  21. = gopher-display-image                                                    =
  22. ===========================================================================
  23. #!/local/bin/perl
  24. #
  25. # gopher-display-image
  26. #
  27. # A script which chooses an image display program based on the filename
  28. # extension of its argument (the file to be displayed).
  29. #
  30. # Last edited: Tue Feb 23 18:59:00 1993 by sag (Scott Glenn) on crane
  31. #
  32. # Check for a parameter: the file[name] to display.
  33. #
  34. if (! $ARGV[0]) {
  35.     print "image-wrapper: no filename specified!\n";
  36.     exit 1;
  37. }
  38. #
  39. # Now determine the extension (and thus the type) of the file.
  40. #
  41. $dot = rindex($ARGV[0], ".");
  42. if ($dot > 0) {
  43.     $ext = substr($ARGV[0],($dot + 1));
  44. }
  45. else {
  46.     print "image-wrapper: no extension parsed from $ARGV[0]\n";
  47.     exit 2;
  48. }
  49. #
  50. # Now run a program to display the image, depending on the extension.
  51. #
  52. if ($ext eq "ps") {
  53.     exec "gv -magstep 3 $ARGV[0]";
  54. }
  55. elsif ($ext eq "dvi") {
  56.     exec "xdvi $ARGV[0]";
  57. }
  58. else {
  59.     exec "xv $ARGV[0]";
  60. }
  61. -- END gopher-display-image --
  62.